<?php

namespace App\Http\Controllers\V1\Api;

use App\Models\V1\Community;

use Illuminate\Http\Request;

class CommunityController extends BaseController
{
    /**
     * 信息分类列表
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function index(Request $request)
    {
        $pageSize = $request->input('pageSize', 100);
        $query = Community::query();
        if($request->filled('province_id')){
            $query->where('province_id',$request->input('province_id'));
        }
        if($request->filled('city_id')){
            $query->where('city_id',$request->input('city_id'));
        }
        if($request->filled('district_id')){
            $query->where('district_id',$request->input('district_id'));
        }
        $data = $query->paginate($pageSize);
        return ajax_output(200, "成功", $data);
    }

}
